[#include "/app/common/layout/__backstagemainlayout.html"/]
[#assign pageJavascript]
<!-- page specific plugin scripts -->
<script src="${ContextPath}/admin/assets/js/jquery.dataTables.js"></script>
<script src="${ContextPath}/admin/assets/js/jquery.dataTables.bootstrap.js"></script>
<script src="${ContextPath}/admin/assets/js/data-tables/dataTables.tableTools.js"></script>
<!-- inline scripts related to this page -->
<script type="text/javascript">

$(".query").click(function(){
	$.ajax({
		type:"post",
		url:"${ContextPath}/admin/notice/queryMail",
		data:{
			"mailid":$(this).attr("mailid"),
		},
		dataType:"json",
		success:function(result){
			$("#mailModal").modal();
			$("#subject").attr("value",result.mail.subject);
			$("#body").text(result.mail.body);
			$("#recipients").text(result.mail.recipients);
			$("#mail_recode").attr("value",result.mail.recode);
			$("#mail_created_at").attr("value",result.mail.created_at);
		},
		error:function(){
			alert("error"+$("#orderid").attr("value"));
		}
	});
});
    
$(".delete").click(function(){
	var mailid=$(this).attr("mailid");
	alertModal(mailid);
	$("#deleteMailModal").modal();
	$("#mailid").attr("value",mailid);
});
    
 $("#deleteMail").click(function(){
	$.ajax({
		type:"post",
		url:"${ContextPath}/admin/notice/deleteMail",
		data:{
			"mailid":$("#mailid").attr("value")
		},
		dataType:"json",
		success:function(result){
			if(result.state="删除成功！"){
				alert("删除成功！");
				location.reload();
			}else if(result.state="删除失败！"){
				
			}
		},
		error:function(){
			alert("error"+$("#mailid").attr("value"));
		}
	
	});
});

function alertModal(msg){
	$("#modal-title-mail").html("提示!");  
	$("#modal-body-mail").html("是否确定删除"+msg+"号记录？");  
}
	
</script>
[/#assign]
[#assign pageCss]
<link rel="stylesheet" href="${ContextPath}/admin/assets/css/data-tables/dataTables.tableTools.css" />
[/#assign]
[@mainlayout pageJavascript=pageJavascript pageCss=pageCss currentMenu="alertinfoFlag-mailListFlag"]

<div class="page-header">
	<h1>
		系统管理
		<small> <i class="ace-icon fa fa-angle-double-right"></i> 邮件通知管理</small>
	</h1>
</div>
<div class="hr hr-dotted"></div>

<div class="row">
	<div class="col-xs-12">
		<!-- PAGE CONTENT BEGINS -->
		
		<div class="row">
			<div class="col-xs-12">
				<div class="table-header">邮件通知日志</div>
				<div>
					<table id="orders" class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								<th >序号</th>
								<th >主题</th>
								<th  class="hidden-480">内容</th>
								<th  class="hidden-480">接收邮箱</th>
								<th ><i class="ace-icon fa fa-clock-o bigger-110 hidden-480"></i>创建时间</th>
								<th ></th>
							</tr>
						</thead>
						
						<tbody>
							[#list mailPage.getList() as mail]
							<tr>

								<td >${mail.id}</td>
								
								<td nowrap title="${(mail.subject)!}">${(mail.subject)!}</td>
								<td class="hidden-480" nowrap title="${(mail.body)!}"><div style="overflow: hidden; width: 350px; height: 20px;">${(mail.body)!}</div></td>
								<td class="hidden-480" nowrap title="${(mail.recipients)!}"><div style="overflow: hidden; width: 200px; height: 20px;">${(mail.recipients)!}</div></td>
								<td >${(mail.created_at)!}</td>

								<td>
									<div class="hidden-sm hidden-xs action-buttons">
										<a class="btn btn-minier btn-primary  blue query" href="#" mailid="${(mail.id)!}"> 查看</a> 
										<a class="btn btn-minier btn-danger red delete" href="#" mailid="${(mail.id)!}"> 删除</a>
									</div>

									<div class="hidden-md hidden-lg">
										<div class="inline position-relative">
											<button class="btn btn-minier btn-yellow dropdown-toggle"
												data-toggle="dropdown" data-position="auto">
												<i class="ace-icon fa fa-caret-down icon-only bigger-120"></i>
											</button>

											<ul
												class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">
												<li>
													<a href="#" class="tooltip-info query" data-rel="tooltip"  title="查看" mailid="${(mail.id)!}"> 
														<span class="blue"> 
																<i class="ace-icon fa fa-search-plus bigger-120"></i>
														</span>
													</a>
												</li>

												<li>
													<a href="#" class="tooltip-error delete" data-rel="tooltip" title="删除" mailid="${(mail.id)!}"> 
														<span class="red">
															<i class="ace-icon fa fa-trash-o bigger-120"></i>
														</span>
													</a>
												</li>
											</ul>
										</div>
									</div>
								</td>
							</tr>
							[/#list]
						</tbody>
					</table>
					[#include "/app/common/inc/_paginate.html" /]
					[@paginate currentPage=mailPage.pageNumber totalPage=mailPage.totalPage actionUrl="/admin/notice/mail/" /]
				</div>
			</div>
		</div>
		<!-- PAGE CONTENT ENDS -->
	</div>
	<!-- /.col -->
</div>
[#include "/app/admin/notice/_model.html" /]
[/@mainlayout]